import java.util.ArrayList;

public class GenericsAndUpcasting {

	public static void main(String[] args) {
		ArrayList<Apple> apples = new ArrayList<Apple>();
		apples.add(new GrannySmith());
		apples.add(new Gala());
		apples.add(new Fuji());
		apples.add(new Braeburn());
		for (Apple apple : apples) {
			System.out.println(apple);
		}

	}
}

// 澳洲青苹
class GrannySmith extends Apple {

}

// 嘎啦苹果
class Gala extends Apple {

}

// 富士苹果
class Fuji extends Apple {

}

//
class Braeburn extends Apple {

}